package com.guopiao.vat.web;

import com.guopiao.vat.common.User;
import com.guopiao.vat.service.UserService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Auther: xander
 * @Date: 2018/7/31 09:55
 * @Description:
 */
@RestController
@Api("swagger2测试controller")
public class Controller {
    @Autowired
    private UserService userService;

    /**
     * 根据用户名获取用户信息，包括从库的地址信息
     *
     * @param userName
     * @return
     */
    @ApiOperation(value = "根据用户名字查询用户信息",notes = "查询用户信息")
    @ApiImplicitParam(name ="userName",value = "用户名",paramType = "path",required = true,dataType = "String")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userName",value = "用户名",dataType = "String",paramType = "query",example = "xiao")
    })
    @ApiResponses({
            @ApiResponse(code=400,message = "请求参数没有填好"),
            @ApiResponse(code=404,message="请求路径没有找到")
    })
    @GetMapping(value = "/testRest")
    public User findByName(@RequestParam String userName) {
        return userService.findByName(userName);
    }

}
